package com.onlyxiahui.framework.net.handler.connect;

import com.onlyxiahui.framework.net.handler.connect.data.ConnectData;
import com.onlyxiahui.framework.net.handler.connect.type.IdleStatus;
import com.onlyxiahui.framework.net.handler.data.handler.MessageHandler;

/**
 * date: 2016-1-4
 * 
 * @author: XiaHui
 */
public interface Connector {

	/**
	 * 
	 * 执行连接<br>
	 * Date 2020-05-11 11:19:08<br>
	 * 
	 * @param connectData
	 * @return
	 * @since 1.0.0
	 */
	public boolean connect(ConnectData connectData);

	/**
	 * 
	 * 是否连接<br>
	 * Date 2020-05-11 11:18:57<br>
	 * 
	 * @return
	 * @since 1.0.0
	 */
	public boolean isConnected();

	/**
	 * 
	 * 关闭连接<br>
	 * Date 2020-05-11 11:18:44<br>
	 * 
	 * @since 1.0.0
	 */
	public void close();

	/**
	 * 
	 * 发送数据<br>
	 * Date 2020-05-11 11:18:31<br>
	 * 
	 * @param data
	 * @return
	 * @since 1.0.0
	 */
	public boolean write(Object data);

	/**
	 * 
	 * 接受数据<br>
	 * Date 2020-05-13 09:36:56<br>
	 * 
	 * @param handler
	 * @since 1.0.0
	 */
	public void addMessageHandler(MessageHandler handler);

	/**
	 * 
	 * 空闲状态<br>
	 * Date 2020-05-12 16:59:22<br>
	 * 
	 * @return
	 * @since 1.0.0
	 */
	public IdleStatus getIdleStatus();
}
